//地区获取插件 TODO 后续添加配置功能
(function($, undefined) {
	$.fn.address = function() {
		var getData = function(url, id, em) {
			$.ajax({
				type : "GET",
				url : url + id,
				dataType : "JSON",
				success : function(data) {
					if (data.status == 1 && data.data) {
						var html = "";
						$.each(data.data, function(i, n) {
							html += "<option value=\"" + n.code + "\">"
									+ n.name + "</option>";
						});
						$(em).html(html);
					}
				}
			});
		}
		var province = $(this);
		var city = $("#city");

		city.bind('click change', function() {
			getData(areaUrl, city.val(), "#area");
		});

		province.bind('click change', function() {
			$("#area").html("");
			getData(cityUrl, province.val(), "#city");
		});
	}
}(jQuery));
// 广告显示管理选择
(function($, undefined) {
	$.fn.adshow = function() {
		var getData = function(url, id, em) {
			$.ajax({
				type : "GET",
				url : url + id,
				dataType : "JSON",
				success : function(data) {
					if (data.status == 1 && data.data) {
						var html = "";
						$.each(data.data, function(i, n) {
							html += "<option value=\"" + n.id + "\">" + n.name
									+ "</option>";
						});
						$(em).html(html);
					}
				}
			});
		}
		var market = $(this);
		var floor = $("#floor");
		market.bind('change', function() {
			$("#floor").html("");
			$("#brand").html("");
			getData(floorUrl, market.val(), "#floor");
		});
		floor.bind('change', function() {
			$("#brand").html("");
			getData(brandUrl, floor.val(), "#brand");
		});
	}
}(jQuery));
function isDel(message) {
	if(confirm(message)){
		return true;
	}else{
		return false;
	}
}